function [P] = SortP(P)

    for i= 1:length(P)
        P(i).val = Evaluate(P(i));
    end
    [~, Index]=sort([P.val], 'ascend');
    P=P(Index,:);
end

